import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserServiceAssociationVO, UserServiceAssociationForm, UserServiceAssociationQuery } from '@/api/system/userServiceAssociation/types';

/**
 * 查询技师和服务套餐关联列表
 * @param query
 * @returns {*}
 */

export const listUserServiceAssociation = (query?: UserServiceAssociationQuery): AxiosPromise<UserServiceAssociationVO[]> => {
  return request({
    url: '/system/userServiceAssociation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询技师和服务套餐关联详细
 * @param associationId
 */
export const getUserServiceAssociation = (associationId: string | number): AxiosPromise<UserServiceAssociationVO> => {
  return request({
    url: '/system/userServiceAssociation/' + associationId,
    method: 'get'
  });
};

/**
 * 新增技师和服务套餐关联
 * @param data
 */
export const addUserServiceAssociation = (data: UserServiceAssociationForm) => {
  return request({
    url: '/system/userServiceAssociation',
    method: 'post',
    data: data
  });
};

/**
 * 修改技师和服务套餐关联
 * @param data
 */
export const updateUserServiceAssociation = (data: UserServiceAssociationForm) => {
  return request({
    url: '/system/userServiceAssociation',
    method: 'put',
    data: data
  });
};

/**
 * 删除技师和服务套餐关联
 * @param associationId
 */
export const delUserServiceAssociation = (associationId: string | number | Array<string | number>) => {
  return request({
    url: '/system/userServiceAssociation/' + associationId,
    method: 'delete'
  });
};
